import idUtils from '@/core/utils/idUtils'
import { MockMethod } from 'vite-plugin-mock'
import mockProdServerUtils from '../../utils/mockUtils'

const timeout = 50

const mockList = [
	// 登录接口
	{
		url: '/mock/amis/api/sample',
		method: 'get',
		timeout,
		response: ({ body }: any) => {
			const content: any[] = []
			for (let i = 0; i < 10; i++) {
				content.push({
					engine: 'Gecko - t8lof',
					browser: 'Camino 1.0',
					platform: 'OSX.2+',
					version: '1.8',
					grade: 'A',
					id: idUtils.generateNumberId(),
					deleteFlag: 0,
					createTime: new Date().getTime(),
					updateTime: new Date().getTime(),
					rowVersion: 1,
				})
			}
			return {
				code: 0,
				message: 'ok',
				data: {
					total: 1710,
					content: content,
				},
			}
		},
	},
	{
		url: '/amis/api/mock2/sample',
		method: 'post',
		timeout,
		response: ({ body }: any) => {
			return {
				code: 0,
				message: 'ok',
			}
		},
	},
] as MockMethod[]

mockProdServerUtils.addPriorityMockList(1, ...mockList)
